﻿#include <CommonUnits/Units/Voltage.h>
#include <gtest/gtest.h>

TEST(AdjustUnitTest, AdjustUnit)
{
    {
        CU::Volt v(0.1);
        auto [value, unit] = CU::adjustUnit<CU::Millivolt, CU::Volt, CU::Kilovolt, CU::Megavolt>(v);
        EXPECT_EQ(v, CU::Millivolt(value));
    }
    {
        CU::Volt v(10.0);
        auto [value, unit] = CU::adjustUnit<CU::Volt, CU::Kilovolt, CU::Megavolt>(v);
        EXPECT_EQ(v, CU::Volt(value));
    }
    {
        CU::Volt v(1000.0);
        auto [value, unit] = CU::adjustUnit<CU::Volt, CU::Kilovolt, CU::Megavolt>(v);
        EXPECT_EQ(v, CU::Kilovolt(value));
    }
    {
        CU::Volt v(1000000.0);
        auto [value, unit] = CU::adjustUnit<CU::Volt, CU::Kilovolt, CU::Megavolt>(v);
        EXPECT_EQ(v, CU::Megavolt(value));
    }
}

int main(int argc, char* argv[])
{
    testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}